Security News
UK Officials Consider Banning Ransomware Payments from Public Entities
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
require-uncached
Advanced tools
The require-uncached npm package allows you to require a module while ensuring that it is not cached. This is useful for scenarios where you need to reload a module to get its latest state or changes, such as during testing or dynamic configuration loading.
Require a module without caching
This feature allows you to require a module without it being cached. This means that every time you require the module using require-uncached, it will be freshly loaded, ensuring you get the latest state or changes.
const requireUncached = require('require-uncached');
const myModule = requireUncached('./myModule');
The decache package allows you to remove a module from the require cache, forcing it to be reloaded the next time it is required. Unlike require-uncached, which directly requires a module without caching, decache provides a more manual approach where you first decache the module and then require it again.
The clear-require package provides functionality to clear a module from the require cache. Similar to decache, it requires you to manually clear the cache and then require the module again. This package also offers additional features like clearing all modules from the cache.
Require a module bypassing the cache
Useful for testing purposes when you need to freshly require a module.
$ npm install --save require-uncached
// foo.js
let i = 0;
module.exports = () => ++i;
const requireUncached = require('require-uncached');
require('./foo')();
//=> 1
require('./foo')();
//=> 2
requireUncached('./foo')();
//=> 1
requireUncached('./foo')();
//=> 1
MIT © Sindre Sorhus
FAQs
Require a module bypassing the cache
We found that require-uncached demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.